<?php
$_doc = array();
$_doc['title'] = L('tab_category_add');
?>
<include file="pAdmin:header" />
<table class="tabmenu" cellspacing="0">
    <tbody>
        <tr>
            <td class="wedge">&nbsp;</td>
            <td class="wmenu"><a href="__URL__/"><span>{%tab_category_list}</span></a></td>
            <td class="wmenu here"><a href="__URL__/add"><span>{%tab_category_add}</span></a></td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>
<div class="main">
    <ul class="fnc">
        <li><button type="button" class="btn primary" onclick="act('save')">{%action_save}</button></li>
    </ul>
    <form id="ipsForm" class="validateform" name="mainForm" action="__URL__" method="post">
        <input type="hidden" name="a" />
		<table class="ips">
		  <tbody>
	      <tr>
	          <th><label for="parentCategorys" >{%column_parent_category}</label></th>
	          <td>
	              <select id="parentCategorys" name="pid">
	              <?php
                    function _getPrefix($ply){
                        static $_p=array('','&nbsp;&nbsp;&nbsp;');
                        $i=intval($ply);
                        if($i>count($_p)){
                            $_p[]=$_p[$i-2].'&nbsp;&nbsp;&nbsp;';
                        }
                        echo $_p[$i-1];
                    }
	              ?>
	               <iterate name="allCategorys" id="vo">
	                   <option value="{$vo['id']}"><?php _getPrefix($vo['ply']);?>{$vo['name']}</option>
	               </iterate>
	              </select>
	          </td>
	      </tr>
	      <tr>
	          <th class="essential"><label for="pk2">{%column_name}</label></th>
	          <td>
	              <input id="pk2" class="validate[required]" type="text" name="name" maxlength="120" size="40" />
	          </td>
	      </tr>
          <tr>
              <th><label for="pk22">{%column_alias}</label></th>
              <td>
                  <input id="pk22" type="text" name="alias" maxlength="120" size="40" />
              </td>
          </tr>
	      <tr>
	          <th><label for="pk3">{%column_classify}</label></th>
	          <td>
	              <select id="pk3" name="classify" onchange="toggleJump(this)">
	                  <option value="list">{%categorytype_list}</option>
	                  <option value="jump">{%categorytype_jump}</option>
	              </select>
	              <script type="text/javascript">
	                  function toggleJump(obj){
	                      var tbody=$("jumpTbody");
	                      if(obj.options[obj.selectedIndex].value=="jump"){
	                          tbody.style.display=(Browser.Engine.trident)?"block":"table-row-group";
	                      }else{
	                          tbody.style.display="none";
	                      }
	                  }
	              </script>
	            </td>
	        </tr>
	    </tbody>
	    <tbody id="jumpTbody" style="display:none">
	        <tr>
	            <th class="essential"><label for="pk4">{%column_jump}</label></th>
	            <td>
	                <input id="pk4" type="text" name="jump" maxlength="255" size="54" />
	            </td>
	        </tr>
	    </tbody>
	    <tbody>
	        <tr>
	            <th><label for="pk5">{%column_category_keywords}</label></th>
	            <td>
	                <textarea id="pk5" name="keywords" rows="2" cols="60"></textarea>
	            </td>
	        </tr>
	        <tr>
	            <th><label for="pk6">{%column_category_desc}</label></th>
	            <td>
	                <textarea id="pk6" name="describe" rows="2" cols="60"></textarea>
	            </td>
	        </tr>
	    </tbody>
	</table>
	</form>
    <ul class="fnc">
        <li><button type="button" class="btn primary" onclick="act('save')">{%action_save}</button></li>
    </ul>
</div>
<include file="pAdmin:footer" />